const express = require('express');
const router = express.Router();
const wrongQuestionController = require('../controllers/wrongQuestionController');
const userController = require('../controllers/userController');

// 应用中间件，所有路由都需要验证token
router.use(userController.verifyToken);

// 新增错题记录
router.post('/add', wrongQuestionController.addWrongQuestion);

// 获取用户的错题列表
router.get('/list', wrongQuestionController.getUserWrongQuestions);

// 获取题目的错误统计
router.get('/question/:questionId', wrongQuestionController.getQuestionWrongStats);

// 删除错题记录(通过query参数，支持id或userId+questionId组合)
router.delete('/delete', wrongQuestionController.deleteWrongQuestion);

// 获取错题列表(带被做错次数)
router.get('/wrongList', wrongQuestionController.getWrongQuestionList);

module.exports = router; 